package cn.gson.fengboot.model.pojos;

import javax.persistence.*;
import java.math.BigDecimal;
import java.util.Objects;

@Entity
public class Zcontractdetails {
    private int condeId;//合同详情id
    private Zcontract conId;//合同主表
    private Qproductdetail prodetailId;//产品
    private Integer condeNum;//数量
    private BigDecimal condeTital;//小计
    private String condeDiscount;//折扣
    private String condeNote;//备注
    private BigDecimal condeJg;//单价

    @Id
    @Column(name = "conde_id")
    @GeneratedValue(strategy= GenerationType.IDENTITY)   //自增长
    public int getCondeId() {
        return condeId;
    }

    public void setCondeId(int condeId) {
        this.condeId = condeId;
    }

    @ManyToOne
    @JoinColumn(name = "con_id", referencedColumnName = "con_id")
    public Zcontract getConId() {
        return conId;
    }

    public void setConId(Zcontract conId) {
        this.conId = conId;
    }

    @ManyToOne
    @JoinColumn(name = "prodetail_id", referencedColumnName = "prodetail_id")
    public Qproductdetail getProdetailId() {
        return prodetailId;
    }

    public void setProdetailId(Qproductdetail prodetailId) {
        this.prodetailId = prodetailId;
    }

    @Basic
    @Column(name = "conde_jg")
    public BigDecimal getCondeJg() {
        return condeJg;
    }

    public void setCondeJg(BigDecimal condeJg) {
        this.condeJg = condeJg;
    }

    @Basic
    @Column(name = "conde_num")
    public Integer getCondeNum() {
        return condeNum;
    }

    public void setCondeNum(Integer condeNum) {
        this.condeNum = condeNum;
    }

    @Basic
    @Column(name = "conde_tital")
    public BigDecimal getCondeTital() {
        return condeTital;
    }

    public void setCondeTital(BigDecimal condeTital) {
        this.condeTital = condeTital;
    }

    @Basic
    @Column(name = "conde_discount")
    public String getCondeDiscount() {
        return condeDiscount;
    }

    public void setCondeDiscount(String condeDiscount) {
        this.condeDiscount = condeDiscount;
    }

    @Basic
    @Column(name = "conde_note")
    public String getCondeNote() {
        return condeNote;
    }

    public void setCondeNote(String condeNote) {
        this.condeNote = condeNote;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Zcontractdetails that = (Zcontractdetails) o;
        return condeId == that.condeId &&
                Objects.equals(conId, that.conId) &&
                Objects.equals(prodetailId, that.prodetailId) &&
                Objects.equals(condeNum, that.condeNum) &&
                Objects.equals(condeTital, that.condeTital) &&
                Objects.equals(condeDiscount, that.condeDiscount) &&
                Objects.equals(condeNote, that.condeNote);
    }

    @Override
    public int hashCode() {
        return Objects.hash(condeId, conId, prodetailId, condeNum, condeTital, condeDiscount, condeNote);
    }


}
